import request from '@/utils/request'

// 查询供应商管理列表
export function listManagement(query) {
  return request({
    url: '/erp_supplier/management/list',
    method: 'get',
    params: query
  })
}

// 查询供应商管理详细
export function getManagement(id) {
  return request({
    url: '/erp_supplier/management/' + id,
    method: 'get'
  })
}

// 新增供应商管理
export function addManagement(data) {
  return request({
    url: '/erp_supplier/management',
    method: 'post',
    data: data
  })
}

// 修改供应商管理
export function updateManagement(data) {
  return request({
    url: '/erp_supplier/management',
    method: 'put',
    data: data
  })
}

// 删除供应商管理
export function delManagement(id) {
  return request({
    url: '/erp_supplier/management/' + id,
    method: 'delete'
  })
}
  // 额外功能

  export function tijiao(data) {
    return request({
      url: 'erp_supplier/management/saveUpdateaudit',
      method: 'post',
      data: data
    })
  }


  export function shenhe(data) {
    return request({
      url: 'erp_supplier/management/saveUpdateaudit',
      method: 'post',
      data: data
    })
  }
  export function baocun(data) {
    return request({
      url: 'erp_supplier/management/saveUpdateaudit',
      method: 'post',
      data: data
    })
  }

export function updatetijiao(id) {
  return request({
    url:`/erp_supplier/management/submit/${id}`,
    method: 'post'
  })
}

export function updateshenhe(id,opinion,choice) {
  return request({
    url: '/erp_supplier/management/updateaudit',
    method: 'post',
    params: {
      id: Number(id),     // 确保是数字且不带 []
      opinion: opinion,   // 参数名和后端完全一致
      choice: Number(choice)
    }
  })
}

